package com.tcm.job;

import com.tcm.job.job.*;
import com.tcm.job.jobtask.QuartzJobManager;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class ProjectInfo implements ApplicationListener<ApplicationReadyEvent> {
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
        System.out.println("ProjectInfo信息执行了");
        try {

            //每日结算一次总结算单
            QuartzJobManager.getInstance().addJob(OrderSettlementByDayQuartz.class, "OrderSettlementByDay","Order", "0 0 0 * * ?");
            //每月结算一次日结算单
            QuartzJobManager.getInstance().addJob(OrderSettlementByMonthQuartz.class, "OrderSettlementByMonth","Order", "0 30 0 1 * ?");

            //每日更新 每日累计积分数
            QuartzJobManager.getInstance().addJob(UpdateTodayPointQuartz.class, "UpdateTodayPoint","Point", "0 0 0 * * ?");
            //每日凌晨一点医生结算
            QuartzJobManager.getInstance().addJob(DoctorSettlementQuartz.class, "DoctorSettlement","Settlement", "0 0 1 * * ?");
            //每日凌晨一点业务员结算
            QuartzJobManager.getInstance().addJob(InviterSettlementQuartz.class, "InviterSettlement","Settlement", "0 0 1 * * ?");
            //每月最后一天药房
            QuartzJobManager.getInstance().addJob(StoreSettlementQuartz.class, "StoreSettlement","Settlement", "59 59 23 L * ?");

        }catch (Exception e){
            e.printStackTrace();
        }
    }
}